package com.jkl.gatewayserver.Config;

import com.jkl.gatewayserver.Web.Interceptor.JWTInterceptor;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.context.annotation.Configuration;
import org.springframework.web.servlet.config.annotation.InterceptorRegistry;
import org.springframework.web.servlet.config.annotation.WebMvcConfigurer;

@Configuration
public class WebConfig implements WebMvcConfigurer {
    @Autowired
    private JWTInterceptor JWTInterceptor;

    @Override
    public void addInterceptors(InterceptorRegistry registry) {//添加拦截器
        registry.addInterceptor(JWTInterceptor)
                .addPathPatterns("/**") // 添加拦截路径
                .excludePathPatterns(
                        "/App/login",
                        "/static/**",
                        "/public/**",
                        "/css/**",
                        "/js/**",
                        "/templates/**"); // 排除拦截路径
    }
}
